<?php

define("_SessionName", "addMessage");
require("header.php");

$json = file_get_contents('php://input'); 
$data = json_decode($json, true);

// var_dump($data);

$sql = "INSERT INTO `message_board`(`authorID`, `authorName`, `postTime`, `content`) VALUES
({$data["authorID"]},'{$data["authorName"]}'," . time() . ",'{$data["content"]}')";

// echo $sql . "\n";

if ($conn->query($sql) === TRUE) {
    echo "Succeeded.";
} else {
    echo "Error: " . $sql . "\n" . $conn->error;
}
 
$conn->close();

?>